package com.tdam_2012_g7;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.tdam_2012_g7.data.DataBaseHelper;


public class Activity_Redactar_Email extends Activity{

	private Button btnEnviar;
	private EditText txtFrom;
	private EditText txtTo;
	private EditText txtMsj;
	DataBaseHelper dbHelper;
	String strId;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity__redactar__mail);
        
        txtFrom = (EditText)this.findViewById(R.id.txtEditRemitente);
        txtTo = (EditText)this.findViewById(R.id.txtEditDestinatario);
        txtMsj = (EditText)this.findViewById(R.id.txtMail);
        btnEnviar = (Button)this.findViewById(R.id.btnEnviarMail);
        
        Bundle bundle=getIntent().getExtras();
        strId = bundle.getString("Id");
    }
	
	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity__redactar__mail, menu);
        return true;
    }

	public void btnEnviarMail_Click(View view)
	{
		boolean ok=true;
		try
		{
			dbHelper = new DataBaseHelper(this);
		}
		catch(Exception ex)
		{
			ok=false;
		}
		finally
		{
			if(ok)
			{
				Intent intentMain = new Intent(this, Activity_Enviar_Mail.class);
				intentMain.putExtra(Intent.EXTRA_EMAIL, txtTo.getText().toString());
				intentMain.putExtra(Intent.EXTRA_TEXT, txtMsj.getText().toString());
				startActivity(intentMain);
				//NotifyEmpAdded();
			}
		}
	}
	
	

    
}
